home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Unix / GopherTools / tstb / tsp < prev    next >
Encoding:
Text File  |  1992-10-14  |  1.3 KB  |  42 lines

  1. #!/usr/local/bin/perl
  2. # ts, boone, 07/27/92
  3. # Search for keywords in Gopher user-visible filenames
  4. # Copyright (C) 1992, Trustees of Michigan State University
  5. #
  6. # Modifications:
  7. # 07/27/92 Boone      Initial coding
  8. # 09/10/92 Boone      Ts was losing some items due to identical paths.
  9. #                     These were mostly root directory items and telnet
  10. #                     sessions.  The way ts build the associative array
  11. #                     index now includes both the user string and the
  12. #                     selector.  Ts now searches just the user visible
  13. #                     title field.
  14. # End Modifications
  15. #
  16. # Version 1.2
  17. #
  18. # Description:
  19. #
  20. # Ts searches for a keyword in an index file containing a complete
  21. # Gopher-style directory of a file tree.  The index can be created with
  22. # the tb program.  The search is caseless.
  23. #
  24. # Comments and bug reports to boone@convex.cl.msu.edu.
  25. # Feedback on how useful the sort really is would be appreciated.  Note
  26. # however that it consumes fairly few cycles compared to the search itself.
  27. # End Description
  28.  
  29. open(TSLOG, ">>.ts/.tslog");
  30. chop($d = `date`);
  31. open(DB, ".ts/.tsdata") || die;
  32. $words = join("|", split(/ /, $ARGV[0]));
  33. @plist = grep(/^[^\t]*($words)[^\t]*\t/i, <DB>);
  34. sort(@plist);
  35. foreach $i (@plist)
  36. {
  37.     print stdout $i;
  38. }
  39. print stdout ".\n";
  40. close(TSLOG);
  41. close(DB);
  42.